package com.upb.webserver.dao.mapper;

import com.upb.webserver.dao.entity.TbDeveloperAppMap;
import com.upb.webserver.dao.entity.TbDeveloperAppMapExample;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;
import java.util.List;
import java.util.Optional;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;

public interface TbDeveloperAppMapMapper {

    @Select({ "select", TbDeveloperAppMapSqlProvider.ALL_COLUMN_FIELDS, "from tb_developer_app_map", "where application_id = #{appId,jdbcType=INTEGER} and  developer_id = #{developerId,jdbcType=INTEGER}" })
    @Results({ @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "developer_id", property = "developerId", jdbcType = JdbcType.INTEGER), @Result(column = "developer_account", property = "developerAccount", jdbcType = JdbcType.VARCHAR), @Result(column = "application_id", property = "applicationId", jdbcType = JdbcType.INTEGER), @Result(column = "application_final_name", property = "applicationFinalName", jdbcType = JdbcType.VARCHAR), @Result(column = "sdk_app_id", property = "sdkAppId", jdbcType = JdbcType.VARCHAR), @Result(column = "private_key", property = "privateKey", jdbcType = JdbcType.VARCHAR), @Result(column = "public_key_base64", property = "publicKeyBase64", jdbcType = JdbcType.VARCHAR), @Result(column = "public_key_ec_point", property = "publicKeyEcPoint", jdbcType = JdbcType.VARCHAR), @Result(column = "chain_type", property = "chainType", jdbcType = JdbcType.TINYINT), @Result(column = "encryption_id", property = "encryptionId", jdbcType = JdbcType.TINYINT), @Result(column = "chain_id", property = "chainId", jdbcType = JdbcType.INTEGER), @Result(column = "gmt_create", property = "gmtCreate", jdbcType = JdbcType.TIMESTAMP), @Result(column = "gmt_modified", property = "gmtModified", jdbcType = JdbcType.TIMESTAMP), @Result(column = "key_store_type", property = "keyStoreType", jdbcType = JdbcType.INTEGER), @Result(column = "gateway_encrypt_type", property = "gatewayEncryptType", jdbcType = JdbcType.INTEGER) })
    List<TbDeveloperAppMap> selectByApplicationAndDeveloper(@Param("appId") Integer appId, @Param("developerId") Integer developerId);

    @Delete({ "delete from tb_developer_app_map", "where chain_id = #{chainId,jdbcType=INTEGER}" })
    int deleteByChainId(@Param("chainId") Integer chainId);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_developer_app_map
     *
     * @mbg.generated
     */
    @SelectProvider(type = TbDeveloperAppMapSqlProvider.class, method = "countByExample")
    long countByExample(TbDeveloperAppMapExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_developer_app_map
     *
     * @mbg.generated
     */
    @DeleteProvider(type = TbDeveloperAppMapSqlProvider.class, method = "deleteByExample")
    int deleteByExample(TbDeveloperAppMapExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_developer_app_map
     *
     * @mbg.generated
     */
    @Delete({ "delete from tb_developer_app_map", "where id = #{id,jdbcType=INTEGER}" })
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_developer_app_map
     *
     * @mbg.generated
     */
    @Insert({ "insert into tb_developer_app_map (developer_id, developer_account, ", "application_id, application_final_name, ", "sdk_app_id, private_key, ", "public_key_base64, public_key_ec_point, ", "chain_type, encryption_id, ", "chain_id, gmt_create, ", "gmt_modified, key_store_type, ", "gateway_encrypt_type)", "values (#{developerId,jdbcType=INTEGER}, #{developerAccount,jdbcType=VARCHAR}, ", "#{applicationId,jdbcType=INTEGER}, #{applicationFinalName,jdbcType=VARCHAR}, ", "#{sdkAppId,jdbcType=VARCHAR}, #{privateKey,jdbcType=VARCHAR}, ", "#{publicKeyBase64,jdbcType=VARCHAR}, #{publicKeyEcPoint,jdbcType=VARCHAR}, ", "#{chainType,jdbcType=TINYINT}, #{encryptionId,jdbcType=TINYINT}, ", "#{chainId,jdbcType=INTEGER}, #{gmtCreate,jdbcType=TIMESTAMP}, ", "#{gmtModified,jdbcType=TIMESTAMP}, #{keyStoreType,jdbcType=INTEGER}, ", "#{gatewayEncryptType,jdbcType=INTEGER})" })
    @SelectKey(statement = "SELECT LAST_INSERT_ID()", keyProperty = "id", before = false, resultType = Integer.class)
    int insert(TbDeveloperAppMap record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_developer_app_map
     *
     * @mbg.generated
     */
    @InsertProvider(type = TbDeveloperAppMapSqlProvider.class, method = "insertSelective")
    @SelectKey(statement = "SELECT LAST_INSERT_ID()", keyProperty = "id", before = false, resultType = Integer.class)
    int insertSelective(TbDeveloperAppMap record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_developer_app_map
     *
     * @mbg.generated
     */
    @SelectProvider(type = TbDeveloperAppMapSqlProvider.class, method = "selectByExample")
    @Results({ @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "developer_id", property = "developerId", jdbcType = JdbcType.INTEGER), @Result(column = "developer_account", property = "developerAccount", jdbcType = JdbcType.VARCHAR), @Result(column = "application_id", property = "applicationId", jdbcType = JdbcType.INTEGER), @Result(column = "application_final_name", property = "applicationFinalName", jdbcType = JdbcType.VARCHAR), @Result(column = "sdk_app_id", property = "sdkAppId", jdbcType = JdbcType.VARCHAR), @Result(column = "private_key", property = "privateKey", jdbcType = JdbcType.VARCHAR), @Result(column = "public_key_base64", property = "publicKeyBase64", jdbcType = JdbcType.VARCHAR), @Result(column = "public_key_ec_point", property = "publicKeyEcPoint", jdbcType = JdbcType.VARCHAR), @Result(column = "chain_type", property = "chainType", jdbcType = JdbcType.TINYINT), @Result(column = "encryption_id", property = "encryptionId", jdbcType = JdbcType.TINYINT), @Result(column = "chain_id", property = "chainId", jdbcType = JdbcType.INTEGER), @Result(column = "gmt_create", property = "gmtCreate", jdbcType = JdbcType.TIMESTAMP), @Result(column = "gmt_modified", property = "gmtModified", jdbcType = JdbcType.TIMESTAMP), @Result(column = "key_store_type", property = "keyStoreType", jdbcType = JdbcType.INTEGER), @Result(column = "gateway_encrypt_type", property = "gatewayEncryptType", jdbcType = JdbcType.INTEGER) })
    List<TbDeveloperAppMap> selectByExample(TbDeveloperAppMapExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_developer_app_map
     *
     * @mbg.generated
     */
    @Select({ "select", "id, developer_id, developer_account, application_id, application_final_name, ", "sdk_app_id, private_key, public_key_base64, public_key_ec_point, chain_type, ", "encryption_id, chain_id, gmt_create, gmt_modified, key_store_type, gateway_encrypt_type", "from tb_developer_app_map", "where id = #{id,jdbcType=INTEGER}" })
    @Results({ @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "developer_id", property = "developerId", jdbcType = JdbcType.INTEGER), @Result(column = "developer_account", property = "developerAccount", jdbcType = JdbcType.VARCHAR), @Result(column = "application_id", property = "applicationId", jdbcType = JdbcType.INTEGER), @Result(column = "application_final_name", property = "applicationFinalName", jdbcType = JdbcType.VARCHAR), @Result(column = "sdk_app_id", property = "sdkAppId", jdbcType = JdbcType.VARCHAR), @Result(column = "private_key", property = "privateKey", jdbcType = JdbcType.VARCHAR), @Result(column = "public_key_base64", property = "publicKeyBase64", jdbcType = JdbcType.VARCHAR), @Result(column = "public_key_ec_point", property = "publicKeyEcPoint", jdbcType = JdbcType.VARCHAR), @Result(column = "chain_type", property = "chainType", jdbcType = JdbcType.TINYINT), @Result(column = "encryption_id", property = "encryptionId", jdbcType = JdbcType.TINYINT), @Result(column = "chain_id", property = "chainId", jdbcType = JdbcType.INTEGER), @Result(column = "gmt_create", property = "gmtCreate", jdbcType = JdbcType.TIMESTAMP), @Result(column = "gmt_modified", property = "gmtModified", jdbcType = JdbcType.TIMESTAMP), @Result(column = "key_store_type", property = "keyStoreType", jdbcType = JdbcType.INTEGER), @Result(column = "gateway_encrypt_type", property = "gatewayEncryptType", jdbcType = JdbcType.INTEGER) })
    TbDeveloperAppMap selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_developer_app_map
     *
     * @mbg.generated
     */
    @UpdateProvider(type = TbDeveloperAppMapSqlProvider.class, method = "updateByExampleSelective")
    int updateByExampleSelective(@Param("record") TbDeveloperAppMap record, @Param("example") TbDeveloperAppMapExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_developer_app_map
     *
     * @mbg.generated
     */
    @UpdateProvider(type = TbDeveloperAppMapSqlProvider.class, method = "updateByExample")
    int updateByExample(@Param("record") TbDeveloperAppMap record, @Param("example") TbDeveloperAppMapExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_developer_app_map
     *
     * @mbg.generated
     */
    @UpdateProvider(type = TbDeveloperAppMapSqlProvider.class, method = "updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(TbDeveloperAppMap record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_developer_app_map
     *
     * @mbg.generated
     */
    @Update({ "update tb_developer_app_map", "set developer_id = #{developerId,jdbcType=INTEGER},", "developer_account = #{developerAccount,jdbcType=VARCHAR},", "application_id = #{applicationId,jdbcType=INTEGER},", "application_final_name = #{applicationFinalName,jdbcType=VARCHAR},", "sdk_app_id = #{sdkAppId,jdbcType=VARCHAR},", "private_key = #{privateKey,jdbcType=VARCHAR},", "public_key_base64 = #{publicKeyBase64,jdbcType=VARCHAR},", "public_key_ec_point = #{publicKeyEcPoint,jdbcType=VARCHAR},", "chain_type = #{chainType,jdbcType=TINYINT},", "encryption_id = #{encryptionId,jdbcType=TINYINT},", "chain_id = #{chainId,jdbcType=INTEGER},", "gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},", "gmt_modified = #{gmtModified,jdbcType=TIMESTAMP},", "key_store_type = #{keyStoreType,jdbcType=INTEGER},", "gateway_encrypt_type = #{gatewayEncryptType,jdbcType=INTEGER}", "where id = #{id,jdbcType=INTEGER}" })
    int updateByPrimaryKey(TbDeveloperAppMap record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_developer_app_map
     *
     * @mbg.generated
     */
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    @Insert({ "<script>", "insert into tb_developer_app_map (developer_id, ", "developer_account, application_id, ", "application_final_name, sdk_app_id, ", "private_key, public_key_base64, ", "public_key_ec_point, chain_type, ", "encryption_id, chain_id, ", "gmt_create, gmt_modified, ", "key_store_type, gateway_encrypt_type)", "values<foreach collection=\"list\" item=\"detail\" index=\"index\" separator=\",\">(#{detail.developerId,jdbcType=INTEGER}, ", "#{detail.developerAccount,jdbcType=VARCHAR}, #{detail.applicationId,jdbcType=INTEGER}, ", "#{detail.applicationFinalName,jdbcType=VARCHAR}, #{detail.sdkAppId,jdbcType=VARCHAR}, ", "#{detail.privateKey,jdbcType=VARCHAR}, #{detail.publicKeyBase64,jdbcType=VARCHAR}, ", "#{detail.publicKeyEcPoint,jdbcType=VARCHAR}, #{detail.chainType,jdbcType=TINYINT}, ", "#{detail.encryptionId,jdbcType=TINYINT}, #{detail.chainId,jdbcType=INTEGER}, ", "#{detail.gmtCreate,jdbcType=TIMESTAMP}, #{detail.gmtModified,jdbcType=TIMESTAMP}, ", "#{detail.keyStoreType,jdbcType=INTEGER}, #{detail.gatewayEncryptType,jdbcType=INTEGER})</foreach></script>" })
    int batchInsert(List<TbDeveloperAppMap> list);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_developer_app_map
     *
     * @mbg.generated
     */
    @SelectProvider(type = TbDeveloperAppMapSqlProvider.class, method = "getOneByExample")
    @Results({ @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "developer_id", property = "developerId", jdbcType = JdbcType.INTEGER), @Result(column = "developer_account", property = "developerAccount", jdbcType = JdbcType.VARCHAR), @Result(column = "application_id", property = "applicationId", jdbcType = JdbcType.INTEGER), @Result(column = "application_final_name", property = "applicationFinalName", jdbcType = JdbcType.VARCHAR), @Result(column = "sdk_app_id", property = "sdkAppId", jdbcType = JdbcType.VARCHAR), @Result(column = "private_key", property = "privateKey", jdbcType = JdbcType.VARCHAR), @Result(column = "public_key_base64", property = "publicKeyBase64", jdbcType = JdbcType.VARCHAR), @Result(column = "public_key_ec_point", property = "publicKeyEcPoint", jdbcType = JdbcType.VARCHAR), @Result(column = "chain_type", property = "chainType", jdbcType = JdbcType.TINYINT), @Result(column = "encryption_id", property = "encryptionId", jdbcType = JdbcType.TINYINT), @Result(column = "chain_id", property = "chainId", jdbcType = JdbcType.INTEGER), @Result(column = "gmt_create", property = "gmtCreate", jdbcType = JdbcType.TIMESTAMP), @Result(column = "gmt_modified", property = "gmtModified", jdbcType = JdbcType.TIMESTAMP), @Result(column = "key_store_type", property = "keyStoreType", jdbcType = JdbcType.INTEGER), @Result(column = "gateway_encrypt_type", property = "gatewayEncryptType", jdbcType = JdbcType.INTEGER) })
    Optional<TbDeveloperAppMap> getOneByExample(TbDeveloperAppMapExample example);
}
